{% extends "student/base.html" %}
{% block content %}
<head>
    <meta charset="UTF-8">
    <title>show_student</title>
    <link rel="stylesheet" href="{{ STATIC_URL }}common.css">
</head>
<body>
<div class="wrapper">
    <form>
        <div class="group">
            <input type="text" id="coursename" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>课程名</label>
        </div>
        <div class="group">
            <input type="text" id="courseid" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>课程id</label>
        </div>
        <div class="group">
            <input type="text" id="teacher" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>任课教师</label>
        </div>
        <div class="group">
            <input type="text" id="schooltime" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>上课时间</label>
        </div>
        <div class="group">
            <input type="text" id="place" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>上课地点</label>
        </div>
         <div class="group">
            <input type="text" id="grade" required="required" /><span class="highlight"></span><span class="bar"></span>
            <label>课程评分</label>
        </div>
        <div>
            <button type="submit" id="btn" class="btn btn-default">submit</button>
        </div>
    </form>
</div>
</body>
    <script>
    function add_course() {
        $.ajax({
            type: "GET",
            url:   "{{ SITE_URL }}student/addcourse/",
            data: {
                    "courseid" : $("#courseid").val(),
                    "coursename" : $("#coursename").val(),
                    "teacher" : $("#teacher").val(),
                    "schooltime" : $("#schooltime").val(),
                    "place" : $("#place").val(),
                    "grade" : $("#grade").val(),
            },
            success:function (response) {
                alert(response['message'])
            },
    })
    }
    $("#btn").click(function (){
        add_course()
    })
   </script>
{% endblock %}